<?php
/*
刮奖动作模型
*/
class Weixin_actioninfo_result_model extends CI_Model{
	//构造函数
	function __construct(){
		parent::__construct();
		$this->load->database();	
	}
	//全部结果倒叙分页  @start:第几条，$page:多少条
	function sel_result_page($startnum,$pagenum,$sid){
		$arrs="SELECT d.username,d.mobile,c.qid,c.qmobile,c.uid,c.operatetime,c.isoperate,c.admintime,a.aname as aname,b.pname as pname,a.activtype as activtype
		FROM cs_weixin_actioninfo AS a, cs_weixin_actioninfo_prize AS b, cs_weixin_actioninfo_result AS c,cs_user AS d
		WHERE a.aid=c.aid AND b.pid=c.pid AND c.uid=d.user_id AND c.sid={$sid}
		ORDER BY c.isoperate,c.operatetime DESC		
		LIMIT $startnum,$pagenum";
		$query=$this->db->query($arrs);
		return $query->result();
	}	
	
	//查询条数
	function num_result($sid){
		$this->db->select('*');
		$this->db->where("sid",$sid);
		$query=$this->db->get('cs_weixin_actioninfo_result');
		return $query->result();			
	}
	
	//修改记录
	function update_one($qid,$arrs){
		$this->db->where('qid',$qid);
		$this->db->update('cs_weixin_actioninfo_result',$arrs);
	}	
	
	//删除某一条数组
	function delete_one($id){
		$this->db->where("qid",$id);
		return $this->db->delete("cs_weixin_actioninfo_result");
		
	}


}
?>